package com.hand.demo.api.controller.v1;

import org.hzero.boot.platform.profile.ProfileClient;
import org.hzero.core.base.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.choerodon.core.iam.ResourceLevel;
import io.choerodon.swagger.annotation.Permission;
import io.swagger.annotations.ApiOperation;


@RestController("ProfileController.v1")
@RequestMapping("/v1/profile-demo")
public class ProfileController extends BaseController {
    @Autowired
    private ProfileClient profileClient;

    @ApiOperation(value = " 根据配置维护值名得到当前用户最低层次的配置维护值(默认：租户级 > 角色级 > 用户级> 全局）")
    @Permission(level = ResourceLevel.SITE, permissionLogin = true)
    @PostMapping("/profile")
    public String getProfileValueByOptions(Long tenantId, Long userId, Long roleId,String profileName){
        return profileClient.getProfileValueByOptions(tenantId, userId, roleId, profileName);
    }

}
